<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Aquamat: Plik źródłowy hd44780.h (r58/r57)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Wygenerowano przez Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Strona&nbsp;główna</span></a></li>
      <li><a href="pages.html"><span>Dodatkowe&nbsp;strony</span></a></li>
      <li><a href="annotated.html"><span>Struktury&nbsp;Danych</span></a></li>
      <li class="current"><a href="files.html"><span>Pliki</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>Lista&nbsp;plików</span></a></li>
      <li><a href="globals.html"><span>Globalne</span></a></li>
    </ul>
  </div>
<h1>hd44780.h (r58/r57)</h1><a href="hd44780_8h.html">Idź do dokumentacji tego pliku.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * ----------------------------------------------------------------------------</span>
<a name="l00003"></a>00003 <span class="comment"> * &quot;THE BEER-WARE LICENSE&quot; (Revision 42):</span>
<a name="l00004"></a>00004 <span class="comment"> * &lt;joerg@FreeBSD.ORG&gt; wrote this file.  As long as you retain this notice you</span>
<a name="l00005"></a>00005 <span class="comment"> * can do whatever you want with this stuff. If we meet some day, and you think</span>
<a name="l00006"></a>00006 <span class="comment"> * this stuff is worth it, you can buy me a beer in return.        Joerg Wunsch</span>
<a name="l00007"></a>00007 <span class="comment"> * ----------------------------------------------------------------------------</span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> * HD44780 LCD display driver</span>
<a name="l00010"></a>00010 <span class="comment"> * </span>
<a name="l00011"></a>00011 <span class="comment"> * ----------------------------------------------------------------------------</span>
<a name="l00012"></a>00012 <span class="comment"> * I extended and cleanuped a little this lcd libary but, as wish of Joerg the </span>
<a name="l00013"></a>00013 <span class="comment"> * library still stay under &quot;THE BEER-WARE LICENSE&quot;  </span>
<a name="l00014"></a>00014 <span class="comment"> *                                                              Wojciech Todryk</span>
<a name="l00015"></a>00015 <span class="comment"> * ----------------------------------------------------------------------------</span>
<a name="l00016"></a>00016 <span class="comment"> * $Id: hd44780.h 46 2009-03-19 21:19:39Z musashi@todryk.pl $</span>
<a name="l00017"></a>00017 <span class="comment"> */</span>
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <span class="preprocessor">#ifndef HD44780_MODULE_H</span>
<a name="l00020"></a>00020 <span class="preprocessor"></span><span class="preprocessor">#define HD44780_MODULE_H</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span>
<a name="l00026"></a><a class="code" href="hd44780_8h.html#af6f7f4e241c87f28c678aa0101a3944d">00026</a> <span class="preprocessor">#define HD44780_CONTROL_PORTOUT PORT(HD44780_CONTROL_PORT)</span>
<a name="l00027"></a><a class="code" href="hd44780_8h.html#ac97537a88a9d0f341f2b865ff4a35970">00027</a> <span class="preprocessor"></span><span class="preprocessor">#define HD44780_CONTROL_PORTIN  PIN(HD44780_CONTROL_PORT)</span>
<a name="l00028"></a><a class="code" href="hd44780_8h.html#a3ca43900ed6ce6a90015ae5d26d458fb">00028</a> <span class="preprocessor"></span><span class="preprocessor">#define HD44780_CONTROL_DDR     DDR(HD44780_CONTROL_PORT)</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span>
<a name="l00030"></a><a class="code" href="hd44780_8h.html#a4372f17bc5345a8869db266e3377019a">00030</a> <span class="preprocessor">#define HD44780_DATA_PORTOUT    PORT(HD44780_DATA_PORT)</span>
<a name="l00031"></a><a class="code" href="hd44780_8h.html#a10ad2a191930a7e2ea0af828bf3cd41f">00031</a> <span class="preprocessor"></span><span class="preprocessor">#define HD44780_DATA_PORTIN     PIN(HD44780_DATA_PORT)</span>
<a name="l00032"></a><a class="code" href="hd44780_8h.html#a20e39ff6f118384fa6a81705c26ff5eb">00032</a> <span class="preprocessor"></span><span class="preprocessor">#define HD44780_DATA_DDR        DDR(HD44780_DATA_PORT)</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00034"></a><a class="code" href="hd44780_8h.html#ab67ba2848b36fa6fe6b4e25b99fa116b">00034</a> <span class="preprocessor">#define HD44780_BL_PORTOUT    PORT(HD44780_BL_PORT)</span>
<a name="l00035"></a><a class="code" href="hd44780_8h.html#a15d5c1f0cea6868a9e3975c923f8347e">00035</a> <span class="preprocessor"></span><span class="preprocessor">#define HD44780_BL_PORTIN     PIN(HD44780_BL_PORT)</span>
<a name="l00036"></a><a class="code" href="hd44780_8h.html#a7da396b282fb909007514774c3ffe4ee">00036</a> <span class="preprocessor"></span><span class="preprocessor">#define HD44780_BL_DDR        DDR(HD44780_BL_PORT)</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span>
<a name="l00038"></a><a class="code" href="hd44780_8h.html#ada7cd3a1cf5c1b1b59ad6a49ed70644b">00038</a> <span class="preprocessor">#define HD44780_DATABITS \</span>
<a name="l00039"></a>00039 <span class="preprocessor">(_BV(HD44780_D4)|_BV(HD44780_D5)|_BV(HD44780_D6)|_BV(HD44780_D7))</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span>
<a name="l00041"></a><a class="code" href="hd44780_8h.html#a167449392118b3ac2aedbb2ddc46675b">00041</a> <span class="preprocessor">#define HD44780_BUSYFLAG 0x80</span>
<a name="l00042"></a>00042 <span class="preprocessor"></span>
<a name="l00043"></a>00043 <span class="comment">/* Send a command to the LCD controller. */</span>
<a name="l00044"></a><a class="code" href="hd44780_8h.html#ab82ea6c1d0521d1bba6a34bcb3b52b93">00044</a> <span class="preprocessor">#define hd44780_outcmd(n)   hd44780_outbyte((n), 0)</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span>
<a name="l00046"></a>00046 <span class="comment">/* Send a data byte to the LCD controller. */</span>
<a name="l00047"></a><a class="code" href="hd44780_8h.html#aca9c284cc6810aec603722f6610e3be4">00047</a> <span class="preprocessor">#define hd44780_outdata(n)  hd44780_outbyte((n), 1)</span>
<a name="l00048"></a>00048 <span class="preprocessor"></span>
<a name="l00049"></a>00049 <span class="comment">/* Read the address counter and busy flag from the LCD. */</span>
<a name="l00050"></a><a class="code" href="hd44780_8h.html#ada4c1895acf51b7c7e8eac2f1aa52730">00050</a> <span class="preprocessor">#define hd44780_incmd()     hd44780_inbyte(0)</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span>
<a name="l00052"></a>00052 <span class="comment">/* Read the current data byte from the LCD. */</span>
<a name="l00053"></a><a class="code" href="hd44780_8h.html#a16cb8a19148b20a9d6dd67e0337a2d0d">00053</a> <span class="preprocessor">#define hd44780_indata()    hd44780_inbyte(1)</span>
<a name="l00054"></a>00054 <span class="preprocessor"></span>
<a name="l00055"></a><a class="code" href="hd44780_8h.html#a0d42f9628484879d9374dfa0543c1f33">00055</a> <span class="preprocessor">#define hd44780_next_line() hd44780_goto(2,1)</span>
<a name="l00056"></a>00056 <span class="preprocessor"></span>
<a name="l00057"></a><a class="code" href="hd44780_8h.html#abfeb3b67501bfd3a18b3b8f76377936c">00057</a> <span class="preprocessor">#define hd44780_clear()     hd44780_outcmd(HD44780_CLR)</span>
<a name="l00058"></a><a class="code" href="hd44780_8h.html#a228d5394c49dcea04f626415fa903c3a">00058</a> <span class="preprocessor"></span><span class="preprocessor">#define hd44780_home()      hd44780_outcmd(HD44780_HOME)</span>
<a name="l00059"></a><a class="code" href="hd44780_8h.html#ac7b4f7dc201f68157a2419447521dc37">00059</a> <span class="preprocessor"></span><span class="preprocessor">#define hd44780_cursor_on() hd44780_outcmd(HD44780_DISPCTL(1, 1, 0))</span>
<a name="l00060"></a><a class="code" href="hd44780_8h.html#adc2e3f52fc78d55d9d3eaa02aca05119">00060</a> <span class="preprocessor"></span><span class="preprocessor">#define hd44780_cursor_blink()  hd44780_outcmd(HD44780_DISPCTL(1, 1, 1))</span>
<a name="l00061"></a><a class="code" href="hd44780_8h.html#a141c3994d4b99c30f46414df210a69fd">00061</a> <span class="preprocessor"></span><span class="preprocessor">#define hd44780_cursor_off()    hd44780_outcmd(HD44780_DISPCTL(1, 0, 0))</span>
<a name="l00062"></a>00062 <span class="preprocessor"></span>
<a name="l00063"></a><a class="code" href="hd44780_8h.html#a05fc8287a529ff07d9ff89e131fecbfa">00063</a> <span class="preprocessor">#define hd44780_bl_on()     HD44780_BL_PORTOUT |= _BV(HD44780_BL_SWITCH)</span>
<a name="l00064"></a><a class="code" href="hd44780_8h.html#a4c5aee0a88bcb044332b25ed4c5e5e1c">00064</a> <span class="preprocessor"></span><span class="preprocessor">#define hd44780_bl_off()    HD44780_BL_PORTOUT &amp;= ~_BV(HD44780_BL_SWITCH)</span>
<a name="l00065"></a>00065 <span class="preprocessor"></span>
<a name="l00066"></a>00066 <span class="comment">/* Clear LCD display command. */</span>
<a name="l00067"></a><a class="code" href="hd44780_8h.html#a56a224284cd1a059b55123d3ed20aedb">00067</a> <span class="preprocessor">#define HD44780_CLR \</span>
<a name="l00068"></a>00068 <span class="preprocessor">    0x01</span>
<a name="l00069"></a>00069 <span class="preprocessor"></span>
<a name="l00070"></a>00070 <span class="comment">/* Home cursor command. */</span>
<a name="l00071"></a><a class="code" href="hd44780_8h.html#aff291f721c472c22f2cf1975ae829785">00071</a> <span class="preprocessor">#define HD44780_HOME \</span>
<a name="l00072"></a>00072 <span class="preprocessor">    0x02</span>
<a name="l00073"></a>00073 <span class="preprocessor"></span>
<a name="l00074"></a>00074 <span class="comment">/*</span>
<a name="l00075"></a>00075 <span class="comment"> * Select the entry mode.  inc determines whether the address counter</span>
<a name="l00076"></a>00076 <span class="comment"> * auto-increments, shift selects an automatic display shift.</span>
<a name="l00077"></a>00077 <span class="comment"> */</span>
<a name="l00078"></a><a class="code" href="hd44780_8h.html#afc15412b1fec8ccc97ad1145b335987a">00078</a> <span class="preprocessor">#define HD44780_ENTMODE(inc, shift) \</span>
<a name="l00079"></a>00079 <span class="preprocessor">    (0x04 | ((inc)? 0x02: 0) | ((shift)? 1: 0))</span>
<a name="l00080"></a>00080 <span class="preprocessor"></span>
<a name="l00081"></a>00081 <span class="comment">/*</span>
<a name="l00082"></a>00082 <span class="comment"> * Selects disp[lay] on/off, cursor on/off, cursor blink[ing]</span>
<a name="l00083"></a>00083 <span class="comment"> * on/off.</span>
<a name="l00084"></a>00084 <span class="comment"> */</span>
<a name="l00085"></a><a class="code" href="hd44780_8h.html#a08486913e2b7cdfd48d63075ffdb73b3">00085</a> <span class="preprocessor">#define HD44780_DISPCTL(disp, cursor, blink) \</span>
<a name="l00086"></a>00086 <span class="preprocessor">    (0x08 | ((disp)? 0x04: 0) | ((cursor)? 0x02: 0) | ((blink)? 1: 0))</span>
<a name="l00087"></a>00087 <span class="preprocessor"></span>
<a name="l00088"></a>00088 <span class="comment">/*</span>
<a name="l00089"></a>00089 <span class="comment"> * With shift = 1, shift display right or left.</span>
<a name="l00090"></a>00090 <span class="comment"> * With shift = 0, move cursor right or left.</span>
<a name="l00091"></a>00091 <span class="comment"> */</span>
<a name="l00092"></a><a class="code" href="hd44780_8h.html#a34ca1acba86ea0daf6135131a5610f31">00092</a> <span class="preprocessor">#define HD44780_SHIFT(shift, right) \</span>
<a name="l00093"></a>00093 <span class="preprocessor">    (0x10 | ((shift)? 0x08: 0) | ((right)? 0x04: 0))</span>
<a name="l00094"></a>00094 <span class="preprocessor"></span>
<a name="l00095"></a>00095 <span class="comment">/*</span>
<a name="l00096"></a>00096 <span class="comment"> * Function set.  if8bit selects an 8-bit data path, twoline arranges</span>
<a name="l00097"></a>00097 <span class="comment"> * for a two-line display, font5x10 selects the 5x10 dot font (5x8</span>
<a name="l00098"></a>00098 <span class="comment"> * dots if clear).</span>
<a name="l00099"></a>00099 <span class="comment"> */</span>
<a name="l00100"></a><a class="code" href="hd44780_8h.html#afefc163d34dcdc9d345b4fef1110406d">00100</a> <span class="preprocessor">#define HD44780_FNSET(if8bit, twoline, font5x10) \</span>
<a name="l00101"></a>00101 <span class="preprocessor">    (0x20 | ((if8bit)? 0x10: 0) | ((twoline)? 0x08: 0) | \</span>
<a name="l00102"></a>00102 <span class="preprocessor">        ((font5x10)? 0x04: 0))</span>
<a name="l00103"></a>00103 <span class="preprocessor"></span>
<a name="l00104"></a>00104 <span class="comment">/*</span>
<a name="l00105"></a>00105 <span class="comment"> * Set the next character generator address to addr.</span>
<a name="l00106"></a>00106 <span class="comment"> */</span>
<a name="l00107"></a><a class="code" href="hd44780_8h.html#a635066eaeb249a3eeed18ee14df2a316">00107</a> <span class="preprocessor">#define HD44780_CGADDR(addr) \</span>
<a name="l00108"></a>00108 <span class="preprocessor">    (0x40 | ((addr) &amp; 0x3f))</span>
<a name="l00109"></a>00109 <span class="preprocessor"></span>
<a name="l00110"></a>00110 <span class="comment">/*</span>
<a name="l00111"></a>00111 <span class="comment"> * Set the next display address to addr.</span>
<a name="l00112"></a>00112 <span class="comment"> */</span>
<a name="l00113"></a><a class="code" href="hd44780_8h.html#ae407c5a4e20fb2bd69b4b8409e776ed1">00113</a> <span class="preprocessor">#define HD44780_DDADDR(addr) \</span>
<a name="l00114"></a>00114 <span class="preprocessor">    (0x80 | ((addr) &amp; 0x7f))</span>
<a name="l00115"></a>00115 <span class="preprocessor"></span>
<a name="l00116"></a>00116 <span class="keywordtype">void</span> <a class="code" href="hd44780_8c.html#a886b4be6ef1ffb3375b9c47b68e88d9e">hd44780_outbyte</a>(uint8_t b, uint8_t rs);
<a name="l00117"></a>00117 uint8_t <a class="code" href="hd44780_8c.html#a064c3742fb88801c864f4f5d30bce753">hd44780_inbyte</a>(uint8_t rs);
<a name="l00118"></a>00118 <span class="keywordtype">void</span> <a class="code" href="hd44780_8c.html#aa26b9b272454246122f987a0ce64dbb2">hd44780_wait_ready</a>(<span class="keywordtype">void</span>);
<a name="l00119"></a>00119 <span class="keywordtype">void</span> <a class="code" href="hd44780_8c.html#a3d6672f4b18096f7163d0abebebf421d">hd44780_init</a>(<span class="keywordtype">void</span>);
<a name="l00120"></a>00120 <span class="keywordtype">void</span> <a class="code" href="hd44780_8c.html#a2a57c51e99a29b90b3fc0245b973f036">hd44780_outstr</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *s);
<a name="l00121"></a>00121 <span class="keywordtype">void</span> <a class="code" href="hd44780_8c.html#a79c4c751e812f5ad11cc3643c2e2031d">hd44780_outstrn</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *s);
<a name="l00122"></a>00122 <span class="keywordtype">void</span> <a class="code" href="hd44780_8c.html#afa5a3ac9a8ee76dda4f5a7f3005cb12c">hd44780_outstrn_P</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *s);
<a name="l00123"></a>00123 <span class="keywordtype">void</span> <a class="code" href="hd44780_8c.html#a77a08cfb2d7b8fafea0e476859c6d3a6">hd44780_out8dec</a>(<span class="keyword">const</span> uint8_t i);
<a name="l00124"></a>00124 <span class="keywordtype">void</span> <a class="code" href="hd44780_8c.html#ab9b73036c2de1702bf259c6afd540277">hd44780_out8dec3</a>(<span class="keyword">const</span> uint8_t i);
<a name="l00125"></a>00125 <span class="keywordtype">void</span> <a class="code" href="hd44780_8c.html#acde91bc7a0b821c305c59e526cf1b402">hd44780_out16dec</a>(<span class="keyword">const</span> uint16_t i);
<a name="l00126"></a>00126 <span class="keywordtype">void</span> <a class="code" href="hd44780_8c.html#a1a3192facd3a67420398f474eb601f14">hd44780_out4hex</a>(<span class="keyword">const</span> uint8_t i);
<a name="l00127"></a>00127 <span class="keywordtype">void</span> <a class="code" href="hd44780_8c.html#a5e3d264c456cb3604ae64f276a5da7be">hd44780_out8hex</a>(<span class="keyword">const</span> uint8_t i);
<a name="l00128"></a>00128 <span class="keywordtype">void</span> <a class="code" href="hd44780_8c.html#a92bf11465ad55b0b7f38703303981ca9">hd44780_out16hex</a>(<span class="keyword">const</span> uint16_t i);
<a name="l00129"></a>00129 <span class="keywordtype">void</span> <a class="code" href="hd44780_8h.html#af09e5b320326102967c7f74dada5cd57">hd44780_out8bcd</a>(<span class="keyword">const</span> uint8_t i);
<a name="l00130"></a>00130 <span class="keywordtype">void</span> <a class="code" href="hd44780_8c.html#a0cda1afd23fea380d9dfaaa11ecf3ebe">hd44780_goto</a>(uint8_t line, uint8_t pos);
<a name="l00131"></a>00131 <span class="keywordtype">void</span> <a class="code" href="hd44780_8c.html#a524e141129112abe127d81806bfcc9b4">hd44780_printOnLcdDelay</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *s);
<a name="l00132"></a>00132 <span class="keywordtype">void</span> <a class="code" href="hd44780_8c.html#ac633a32fd8e1476547ff9ee0c6b5a2c7">hd44780_switch_state</a>(uint8_t,uint8_t);
<a name="l00133"></a>00133 <span class="keywordtype">void</span> <a class="code" href="hd44780_8c.html#a2adb75182d5a729b3be554cc1a60648d">hd44780_label</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *,uint8_t,uint8_t);
<a name="l00134"></a>00134 
<a name="l00135"></a>00135 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr size="1">
<div style="text-align: center;">
<small>Projekt udostępniony jest na zasadach Open Source. Zapoznaj się z warunkami licencji w pliku COPYING znajdujacym się w katalogu głównym.	</small>
</div>

<hr size="1">
<div style="text-align: center;">
Aquamat - sterownik akwarystyczny Open Source
<br/>
Copyright (C) 2009  <a href="http://todryk.pl">Wojciech Todryk</a> (wojciech(at)todryk(dot)pl)
</div>

<div style="text-align: right;">
<small>Dokumentację wygenerowano za pomocą programu&nbsp;</small>
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a>
<small> wersja 1.6.1 (Fri Apr 23 22:48:16 2010)&nbsp;</small>
</div>
